package com.ywt.cda.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.ywt.cda.core.dao.page.Page;
import com.ywt.cda.dao.Ana2ndDataDao;
import com.ywt.cda.domain.Ana2ndData;

@Service
public class Ana2ndDataService {

	@Resource
	private Ana2ndDataDao ana2ndDataDao;

	public List<Ana2ndData> totalCategory(Map<String, Object> params, Page page) {
		if (null == params) {
			return null;
		}

		String orderBy = (String) params.get("orderBy");
		if (StringUtils.isBlank(orderBy)) {
			return null;
		}
		if ("SUM_NUM".equals(orderBy)) {
			return ana2ndDataDao.totalCategoryByNum(params, page);
		}
		if ("SUM_PRICE".equals(orderBy)) {
			return ana2ndDataDao.totalCategory(params, page);
		}

		return null;
	}
	public List<Ana2ndData> total(Map<String, Object> params, Page page) {
		if (null == params) {
			return null;
		}

		String orderBy = (String) params.get("orderBy");
		if (StringUtils.isBlank(orderBy)) {
			return null;
		}
		if ("SUM_NUM".equals(orderBy)) {
			return ana2ndDataDao.total(params, page);
		}
		if ("SUM_PRICE".equals(orderBy)) {
			return ana2ndDataDao.totalByPrice(params, page);
		}

		return null;
	}
	
}
